Prevent page shift when navbar dropdown opens#2452
Merged
martinbonnin merged 1 commit intoJun 29, 2026
Merged
Conversation
Opening a navbar dropdown (e.g. Community) locks body scroll via `overflow: hidden`, removing the viewport scrollbar and shifting the whole page sideways by the scrollbar width on scrollable pages. Reserve the scrollbar gutter with `scrollbar-gutter: stable` on `html` so the layout width stays constant whether or not the scrollbar is present.
|
@jeanlucaslima is attempting to deploy a commit to the The GraphQL Foundation Team on Vercel. A member of the Team first needs to authorize it. |
martinbonnin
approved these changes
Jun 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Opening a navbar dropdown (e.g. Community) locks page scroll by setting
body { overflow: hidden }(src/components/navbar/navbar.tsx). On pages tall enough to show a scrollbar, this removes the ~15px viewport scrollbar. Because no space was reserved for it, the whole page — including the full-width navbar — shifts sideways by the scrollbar width as the menu opens and back when it closes.Fix
Reserve the scrollbar gutter on
htmlso the layout width stays constant whether or not the scrollbar is present:This is consistent with the
scrollbar-gutter: stablealready used on.nextra-scrollbar, and also covers the mobile menu and any other scroll-lock.Verification
Measured the navbar's right edge while clicking the Community trigger:
autostableThe scroll-lock still works as before; it just no longer shifts the page.
🤖 Generated with Claude Code